DB2 SQL0469N SQLCode-469 SQLSTATE:42886 错误解决

Categories: Database; Tagged with: ; @ October 5th, 2010 0:58

今天在使用JDBC呼叫DB2存储过程时, 出现如题错误.

因为SQL代码在DB2 Editor中运行无误, 但使用JDBC屡屡出错, 最终原因在于在JDBC中INOUT参数只IN未OUT.

DB2CC中自动生成的SQL中直接设定了IN的Value, 但实际要求为INOUT参数, 在JDBC中使用时便会报错.

解决方法为: 查看对应存储过程的API, 修改SQL语句(注意: db2cc自动生成的SQL可能并不适用于JDBC, 还应以API为准).

附录:API信息:

http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.msg.doc/doc/sql0469.htm

SQL0469

SQL0469N

The parameter mode (IN, OUT, or INOUT) is not valid for a parameter in procedure procedure-name with specific name specific-name (parameter number number, name parameter-name).

Explanation:

One of the following errors occurred:

  • a parameter in an SQL procedure is declared as OUT and is used as input in the procedure body
  • a parameter in an SQL procedure is declared as IN and is modified in the procedure body.

User response:

Change the attribute of the parameter to INOUT, or change the use of the parameter within the procedure.

sqlcode: -469

sqlstate: 42886

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.